package com.lzh.demo.task;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Description:
 * @Author: LiuZiHao
 * @Date: 2022/10/17 15:03
 */
@Component
public class DemoJob {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    private final AtomicInteger counts = new AtomicInteger();

//    @Scheduled(fixedRate = 2000)
    public void execute() {
        logger.info("[execute][定时第({})次执行]", counts.incrementAndGet());
    }
}
